<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>智能订餐</title>
    <meta name="description" content="">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui, user-scalable=no">
    <meta http-equiv="cleartype" content="on">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/assets/base/Inforschool/css/style.css">
    <link rel="stylesheet" href="/assets/base/Inforschool/css/layer.css">
</head>
<body>
<div class="wraper">
    <div class="min-height">
        <div class="header font-white">
            <a href="javascript:history.go(-1)" class="iconfont icon-left font-white back"></a>
            <div class="font-16 text-center">套餐选择</div>
        </div>
        <if condition="$condition eq 1">
            <if condition="$status eq 3">
                <div class="bg_white margin-12">
                    <div class="boxs ">
                        学生套餐
                    </div>
                    <div class="boxs ">
                        <div class="flex_between font-gray2 js_choose marginb-10">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1 ">中餐</span>
                            </div>
                            <div class="width-50 choose margin-r20">
                                <!--     <div class="combo_name" data-id="{BEESCRM:$f1id}">{BEESCRM:$f1}</div>-->
                                <!--  <div class="select hide">
                                      <volist name="fooddata1" id="v">
                                          <div class="select_list" data-id="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}
                                          </div>
                                      </volist>
                                      &lt;!&ndash; <div class="select_list last" >其他</div> &ndash;&gt;
                                      <div class="triangle"></div>
                                  </div>-->
                                <div class="selectt">
                                    <select name="" id="" disabled>
                                        <volist name="fooddata1" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                        <div class="flex_between font-gray2 js_choose">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1">晚餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--   <div class="combo_name" data-id="{BEESCRM:$f1id}">{BEESCRM:$f1}</div>
                                   <div class="iconfont icon-xiala"></div>
                                   <div class="select hide">
                                       <volist name="fooddata1" id="v">
                                           <div class="select_list" data-id="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}
                                           </div>
                                       </volist>
                                       &lt;!&ndash; <div class="select_list last" >其他</div> &ndash;&gt;
                                       <div class="triangle"></div>
                                   </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata1" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="bg_white margin-12">
                    <div class="boxs ">
                        教职工套餐
                    </div>
                    <div class="boxs ">
                        <div class="flex_between font-gray2 js_choose marginb-10">
                            <div class="name width-50 margin-l20 ">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1">中餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--     <div class="combo_name" data-id="{BEESCRM:$f2id}">{BEESCRM:$f2}</div>
                                     <div class="iconfont icon-xiala"></div>
                                     <div class="select hide">
                                         <volist name="fooddata2" id="v">
                                             <div class="select_list" data-id="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}
                                             </div>
                                         </volist>
                                         &lt;!&ndash; <div class="select_list last" >其他</div> &ndash;&gt;
                                         <div class="triangle"></div>
                                     </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata2" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                        <div class="flex_between font-gray2 js_choose">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1" data-id="{BEESCRM:$f2id}">晚餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--   <div class="combo_name">{BEESCRM:$f2}</div>
                                   <div class="iconfont icon-xiala"></div>
                                   <div class="select hide">
                                       <volist name="fooddata2" id="v">
                                           <div class="select_list" data-id="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}
                                           </div>
                                       </volist>
                                       &lt;!&ndash; <div class="select_list last" >其他</div>
    &ndash;&gt;
                                       <div class="triangle"></div>
                                   </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata2" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </if>
            <if condition="$status eq 1">
                <div class="bg_white margin-12">
                    <div class="boxs ">
                        学生套餐
                    </div>
                    <div class="boxs ">
                        <div class="flex_between font-gray2 js_choose marginb-10">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1 ">中餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--  <div class="combo_name" data-id="{BEESCRM:$f1id}">{BEESCRM:$f1}</div>
                                  <div class="iconfont icon-xiala"></div>
                                  <div class="select hide">
                                      <volist name="fooddata1" id="v">
                                          <div class="select_list" data-id="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}
                                          </div>
                                      </volist>
                                      &lt;!&ndash;     <div class="select_list last" >其他</div> &ndash;&gt;
                                      <div class="triangle"></div>
                                  </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata1" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                        <div class="flex_between font-gray2 js_choose">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1  ">晚餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--    <div class="combo_name" data-id="{BEESCRM:$f1id}">{BEESCRM:$f1}</div>
                                    <div class="iconfont icon-xiala"></div>
                                    <div class="select hide">
                                        <volist name="fooddata1" id="v">
                                            <div class="select_list" data-id="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}
                                            </div>
                                        </volist>
                                        &lt;!&ndash; <div class="select_list last" >其他</div> &ndash;&gt;
                                        <div class="triangle"></div>
                                    </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata1" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </if>
            <if condition="$status eq 2">
                <div class="bg_white margin-12 js_teacher">
                    <div class="boxs ">
                        教职工套餐
                    </div>
                    <div class="boxs ">
                        <div class="flex_between font-gray2 js_choose marginb-10">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1 ">中餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!-- <div class="combo_name" data-id="{BEESCRM:$f2id}">{BEESCRM:$f2}</div>
                                 <div class="iconfont icon-xiala"></div>
                                 <div class="select hide">
                                     <volist name="fooddata2" id="v">
                                         <div class="select_list" data-id="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}
                                         </div>
                                     </volist>
                                     &lt;!&ndash; <div class="select_list last" >其他</div> &ndash;&gt;
                                     <div class="triangle"></div>
                                 </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata2" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                        <div class="flex_between font-gray2 js_choose">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1" data-id="{BEESCRM:$f2id}">晚餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--  <div class="combo_name">{BEESCRM:$f2}</div>
                                  <div class="iconfont icon-xiala"></div>
                                  <div class="select hide">
                                      <volist name="fooddata2" id="v">
                                          <div class="select_list" data-id="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}
                                          </div>
                                      </volist>
                                      &lt;!&ndash; div class="select_list last" >其他</div> &ndash;&gt;
                                      <div class="triangle"></div>
                                  </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata2" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </if>
        </if>
        <!-- 在接待中才会显示以下模块-->
        <if condition="$condition neq 1">
            <if condition="$condition eq 2">
                <div class="bg_white margin-12">
                    <div class="boxs ">
                        接待套餐
                    </div>
                    <div class="boxs ">
                        <div class="flex_between font-gray2 js_choose marginb-10">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1">中餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--  <div class="combo_name" data-id="{BEESCRM:$f0id}">{BEESCRM:$f0}</div>
                                  <div class="iconfont icon-xiala"></div>
                                  <div class="select hide">
                                      <volist name="fooddata0" id="v">
                                          <div class="select_list " data-id="{BEESCRM:$v['food_id']}">
                                              {BEESCRM:$v['fname']}
                                          </div>
                                      </volist>
                                      <div class="select_list last">其他</div>
                                      <div class="triangle"></div>
                                  </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata0" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                        <option class="last">其他</option>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                        <div class="flex_between font-gray2 js_choose">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1">晚餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--  <div class="combo_name" data-id="{BEESCRM:$fid}">{BEESCRM:$f0}</div>
                                  <div class="iconfont icon-xiala"></div>
                                  <div class="select hide">
                                      <volist name="fooddata0" id="v">
                                          <div class="select_list " data-id="{BEESCRM:$v['food_id']}">
                                              {BEESCRM:$v['fname']}
                                          </div>
                                      </volist>
                                      <div class="select_list last">其他</div>
                                      <div class="triangle"></div>
                                  </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata0" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                        <option class="last">其他</option>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </if>
            <if condition="$condition eq 3">
                <div class="bg_white margin-12">
                    <div class="boxs ">
                        接待套餐
                    </div>
                    <div class="boxs ">
                        <div class="flex_between font-gray2 js_choose marginb-10">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1">中餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!--    <div class="combo_name" data-id="{BEESCRM:$f0id}">{BEESCRM:$f0}</div>
                                    <div class="iconfont icon-xiala"></div>
                                    <div class="select hide">
                                        <volist name="fooddata3" id="v">
                                            <div class="select_list " data-id="{BEESCRM:$v['food_id']}">
                                                {BEESCRM:$v['fname']}
                                            </div>
                                        </volist>
                                        <div class="select_list last">其他</div>
                                        <div class="triangle"></div>
                                    </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata3" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                        <option class="last">其他</option>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                        <div class="flex_between font-gray2 js_choose">
                            <div class="name width-50 margin-l20">
                                <span class="iconfont icon-xuanze1 checkbox"></span>
                                <span class="font-gray1">晚餐</span>
                            </div>
                            <div class="width-50 choose flex_between margin-r20">
                                <!-- <div class="combo_name" data-id="{BEESCRM:$fid}">{BEESCRM:$f0}</div>
                                 <div class="iconfont icon-xiala"></div>
                                 <div class="select hide">
                                     <volist name="fooddata3" id="v">
                                         <div class="select_list " data-id="{BEESCRM:$v['food_id']}">
                                             {BEESCRM:$v['fname']}
                                         </div>
                                     </volist>
                                     <div class="select_list last">其他</div>
                                     <div class="triangle"></div>
                                 </div>-->
                                <div class="selectt">
                                    <select name="" disabled>
                                        <volist name="fooddata3" id="v">
                                            <option value="{BEESCRM:$v['food_id']}">{BEESCRM:$v['fname']}</option>
                                        </volist>
                                        <option class="last">其他</option>
                                    </select>
                                    <div class="iconfont icon-xiala icon-xiala2"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </if>
        </if>
    </div>
    <input type="hidden" id="condition" value="{BEESCRM:$condition}">
    <input type="hidden" id="PID" value="{BEESCRM:$PID}">
    <a href="#" class="btn btn2 font-16 text-center">下一步</a>
    <div class="pop-box height hide">
        <div class="pop-hint font-gray1">
            <div class="top_green"></div>
            <div class="price">
                <p class="hint_txt">请输入价格</p>
                <div class="input_box">
                    <input id="specialprice" type="text">
                </div>
                <!-- <div class="input_box">
                     <input id="specialprice" type="text" placeholder="请输入套餐价格">
                 </div>-->
            </div>
            <input type="hidden" id="or_sn">
            <div class="flex_between pop_bottom text-center">
                <a href="#" class="pop_btn width-50" id="cancel">取消</a>
                <a href="#" class="pop_btn width-50 active" id="specialcheck">确定</a>
            </div>
        </div>
    </div>
</div>
</body>
<script src="/assets/base/Inforschool/js/jquery-2.1.0.min.js"></script>
<script src="/assets/base/Inforschool/js/layer.js"></script>
<script src="/assets/base/Inforschool/js/public.js"></script>
<script>
    var height = $(window).height();
    $('.wraper').css('minHeight', height);
    var btn_height = $('.btn').innerHeight();
    $('.min-height').css('height', height - btn_height);

    $('.js_choose').on('click', '.name', function () {
        var $this = $(this).find('.checkbox');
        if ($this.hasClass('icon-xuanze')) {
            $this.removeClass('icon-xuanze').addClass('icon-xuanze1');
            $(this).siblings().find('select').attr("disabled", true);
        } else {
            $this.removeClass('icon-xuanze1').addClass('icon-xuanze');
            $(this).siblings().find('select').removeAttr("disabled");
        }
    });



    $(document).on('click', '.btn', function () {
        //获取全部选择的id
        var ID = new Array();
        var PID = $('#PID').val();
        if (PID == '') {
            fm.alert('请选择用餐人员！');
            return false;
        }
        var len = $('.js_teacher').length;
        if (len == 1) {
            ID[0] = 0;
            ID[1] = 0;
        }
        var condition = $('#condition').val();
        $('.name .iconfont').each(function () {
            if ($(this).hasClass('icon-xuanze')) {
                ID.push($.trim($(this).parents('.name').siblings('.choose').find('select').val()));
            }
            else {
                ID.push(0);
            }
        });
        ID = ID.join(",");
        if (ID == '0,0,0,0' || ID == '0,0' || ID == '' || ID == ',0' || ID == '0,' || ID == ",") {
            fm.alert('请选择套餐！');
            return false;
        }
        var data = {};
        data.PID = PID;
        data.ID = ID;
        data.condition = condition;
        $.ajax({
            'url': "/base/Inforschool/selectTime",
            'data': data,
            'dataType': 'json',
            'type': 'POST',
            success: function (data) {
                if (data.status == 'S') {
                    setTimeout("reload('" + data.url + "')", 1000);
                } else {
                    return false;
                }
            }
        })
    })
    function reload(url) {
        location.href = url;
    }

    $('.pop-box').on('click', '.pop_btn', function () {
        $('.pop-box').addClass('hide');
    });
    $('select').on('change', function () {
        if ($(this).val() == '其他') {
            $('.pop-box').removeClass('hide');
        }
        list = $(this).find('.last');
         $this=$(this);
        _this=$(this).find('option:first');
        $('.pop-box').on('click','#cancel',function () {
            _this.prop("selected", 'selected');
        })
    });

    $(".pop-box").on('click', '#specialcheck', function () {

        var specialprice = $('#specialprice').val();
        //var specialname = $('#specialname').val();
        var condition = $('#condition').val();
        // if (specialname == "") {
        //     $('.pop-box').removeClass('hide');
        //     fm.alert('请填写套餐名');
        //     return false;
        // }
        if (specialprice == '') {
            $('.pop-box').removeClass('hide');
            fm.alert('请填写价格');
            return false;
        }
        if (isNaN(specialprice)) {
            $('.pop-box').removeClass('hide');
            fm.alert('价格请填写数字！');
            return false;
        }
        if (specialprice <= 0) {
            $('.pop-box').removeClass('hide');
            fm.alert('价格必须大于0！');
            return false;
        }
        var data = {};
        data.specialprice = specialprice;
        data.condition = condition;

        $.ajax({
            'url': "/base/Inforschool/addspecialfood",
            'data': data,
            'dataType': 'json',
            'type': 'POST',
            success: function (data) {
                if (data.status == 'S') {
                    var _html = '  <option value="'+data.fid+'">'+data.fname+'</option>';
                    list.before(_html);
                    $this.val(data.fid);
                }
            },
            error: function () {
                fm.alert('网络错误，请重试');
            }
        })
        $('#specialprice').val('');
    });

</script>
</html>